﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;

namespace MyXnaGame
{
    public class HudContainer
    {
        GraphicsDevice graphicsDevice;
        SpriteBatch spriteBatch;
        SpriteFont hudFont;
        List<HudComponent> hudComponents;
        SafeArea safeArea;

        public void LoadGraphicsContent(GraphicsDevice graphicsDevice, SpriteFont hudFont, SafeArea safeArea)
        {
            hudComponents = new List<HudComponent>();
            //
            this.graphicsDevice = graphicsDevice;
            this.spriteBatch = new SpriteBatch(graphicsDevice);
            this.hudFont = hudFont;
            this.safeArea = safeArea;
        }

        public void Add(HudComponent hudComponent)
        {
            hudComponent.SetFont(hudFont);
            this.hudComponents.Add(hudComponent);
        }

        public void Draw(SpriteBatch spriteBatch)
        {
            foreach (var hudComponent in hudComponents)
            {
                hudComponent.Draw(spriteBatch);
            }
        }
    }
}
